<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script th:src="@{/webjars/jquery/3.3.1-1/jquery.min.js}"> </script>
    <script>
        $(function () {
            $(".delete").click(function () {
                $("#f1").attr("action",this.href).submit();
                return false;
            });
        });
    </script>
    <style>
        h1{
            text-align: center;
        }
        table{
            border-collapse: collapse;
            width:600px;
            margin: 0 auto;
        }
        td,th{
            border:1px solid black;
            line-height:35px;
            text-align: center;
        }
        tr:nth-child(odd){
            background: darkgray;
        }
        p{
            width: 600px;
            text-align: right;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <h1>员工列表</h1>
    <p>
        <a th:href="@{/goods/view}">新增</a><!--生成绝对路径@{请求路径}-->
    </p>
    <table>
        <tr>
            <th>分类id</th>
            <th>分类名称</th>
            <th>上级分类id</th>
            <th>分类说明</th>
            <th>操作</th>


        </tr>
        <tr th:each="goods:${list}">
            <td th:text="${goods.id}"></td>
            <td th:text="${goods.name}"></td>
            <td th:text="${goods.pid}"></td>
            <td th:text="${goods.remark}"></td>

            <td>
                <a th:href="@{'/goods/'+${goods.id}}">修改</a>
                |
                <a class="delete" th:href="@{'/goods/'+ ${goods.id}}">删除</a>
            </td>
        </tr>
    </table>
    <form  id="f1" method="post">
        <input type="hidden" name="_method" value="DELETE">
    </form>
</body>
</html>